package org.geekbang.thinkinginspring.advisors;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * @author jie
 */
public class TestIntroduce {
    public static void main(String[] args) {
        testBeforeAdviceByCode();
    }

    private static void testBeforeAdviceByCode(){
        String configPath = "thinking-in-spring/src/main/resources/META-INF/conf-advice-introduce.xml";
        ApplicationContext ctx = new FileSystemXmlApplicationContext(configPath);
        ForumService forumService = (ForumService)ctx.getBean("forumService");
        forumService.removeForum(10);
        forumService.removeTopic(1022);
        Monitorable monitorable = (Monitorable) forumService;
        monitorable.setMonitorActive(true);
        forumService.removeForum(10);
        forumService.removeTopic(1022);
    }
}
